﻿@using DigDes.DSchool.SUPS.DataAccess.Database
@model DigDes.DSchool.SUPS.MVC.Models.DataModel

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div>
        <table border="1px">
            @{ List<SUPSData> data = (List<SUPSData>) ViewData["data"];}
            @foreach (DigDes.DSchool.SUPS.DataAccess.Database.SUPSData item in data)
            {
                <tr>
                    <td>
                        @item.CarNumber
                    </td>
                    <td>
                        @item.Weight
                    </td>
                    <td>
                        @item.ArrivalStation
                    </td>
                    <td>
                        @item.CargoCode
                    </td>
                    <td>
                        @item.ConsigneeCode
                    </td>
                    <td>
                        @item.CarParkType
                    </td>
                    <td>
                        @item.DispatchStation
                    </td>
                    <td>
                        @item.OperationCode
                    </td>
                    <td>
                        @item.OperationYear
                    </td>
                    <td>
                        @item.OperationDate
                    </td>
                    <td>
                        @item.OperationTime
                    </td>
                    <td>
                        @item.OperationStation
                    </td>
                    <td>
                        @item.RoadOfDelivery
                    </td>
                    <td>
                        @item.RoadOfReception
                    </td>
                    <td>
                        @item.TrainIndex
                    </td>
                    <td>
                        @item.TrainNumber
                    </td>
                </tr>
            }
        </table>
         <br><br>     
        @using (Html.BeginForm())
        {
            @Html.TextBoxFor(model => model.CarNumber);
            <input type="submit" value="Найти"/>
        }       
        <br><br>
         @{
             SUPSData Row= (SUPSData)ViewData["Row"];
           
           
             try{
             if (!Row.Equals(null))
         {
             <table border="1px">
                 <tr>
                    <td>
                        @Row.CarNumber
                    </td>
                    <td>
                        @Row.Weight
                    </td>
                    <td>
                        @Row.ArrivalStation
                    </td>
                    <td>
                        @Row.CargoCode
                    </td>
                    <td>
                        @Row.ConsigneeCode
                    </td>
                    <td>
                        @Row.CarParkType
                    </td>
                    <td>
                        @Row.DispatchStation
                    </td>
                    <td>
                        @Row.OperationCode
                    </td>
                    <td>
                        @Row.OperationYear
                    </td>
                    <td>
                        @Row.OperationDate
                    </td>
                    <td>
                        @Row.OperationTime
                    </td>
                    <td>
                        @Row.OperationStation
                    </td>
                    <td>
                        @Row.RoadOfDelivery
                    </td>
                    <td>
                        @Row.RoadOfReception
                    </td>
                    <td>
                        @Row.TrainIndex
                    </td>
                    <td>
                        @Row.TrainNumber
                    </td>
                </tr>
             </table>
        
         }
         }catch(NullReferenceException){} 
         }

    </div>
</body>
</html>
